//引入uuid去生成唯一id
import { v4 as uuidv4 } from "uuid";

//先在外面读取id，后面再进来这个js文件的时候就有缓存了，不用每次都读取，只需要读一次
let uid = localStorage.getItem("userTempId");
export default function getUid() {
	if (!uid) {
		uid = uuidv4();
		localStorage.setItem("userTempId", uid);
	}
	return uid;
}
